package com.tvunetworks.device.extra.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.commons.lang.StringUtils;

/**
 * R 返回的 2xx 的结果,
 * 101 的接口通常会直接返回对应的信息，如果出现异常则会返回此类型结果
 *
 * @author andy
 **/
@Data
@Accessors(chain = true)
@JsonIgnoreProperties(ignoreUnknown = true)
public class ReceiverActionResult {
    /**
     * success
     */
    public static final String SUCCESS = "0x0";
    protected String errorCode;
    protected String errorInfo;

    /**
     * success
     *
     * @return boolean
     */
    public boolean assertSuccess() {
        if (StringUtils.isEmpty(errorCode)) {
            return true;
        }
        return SUCCESS.equals(errorCode);
    }


}
